-
Notifications
You must be signed in to change notification settings - Fork 180
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Get execution version from snapshot instead of state #6867
Get execution version from snapshot instead of state #6867
Conversation
Codecov ReportAttention: Patch coverage is
Additional details and impacted files@@ Coverage Diff @@
## master #6867 +/- ##
===========================================
- Coverage 41.11% 34.48% -6.64%
===========================================
Files 2116 903 -1213
Lines 185737 78095 -107642
===========================================
- Hits 76368 26928 -49440
+ Misses 102952 49030 -53922
+ Partials 6417 2137 -4280
Flags with carried forward coverage won't be shown. Click here to find out more. ☔ View full report in Codecov by Sentry. |
168376a
to
33bde51
Compare
9c10352
to
8e753d9
Compare
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
👍 Looks good. Some minor suggestions.
return func(ctx Context) Context { | ||
ctx.ReadVersionFromNodeVersionBeacon = enabled | ||
|
||
ctx = WithEntropyProvider(snapshot)(ctx) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
better to add some comments explain how it works for the two lines.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The comment is already on the WithEntropyProvider
and on the snapshot.RandomSource
I don't think it will help adding it here as well
move snapshot provider move snapshot state provider cleanup
8e753d9
to
f4d3c67
Compare
work towards: #6507
Execution version was being read by calling a contract function on the service account. This meant it was read from the execution state. To reduce the impact on execution time it was put in the programs cache next to metering settings (execution effort weights, memory metering weights, memory limit).
The programs cache currently has a problem where it is invalidated on every block. This is due to the metering settings being inlined into the same register as the random beacon history. Since the random beacon history changes on every block, we have no choice but to also invalidate the metering settings. This in turn invalidates the entire programs cache. (programs cache entries contain programs and the execution effort it took to read them, which is derived from the metering settings).
The solution to the programs cache being invalidated on every block, is to move the metering settings to a separate, low/no traffic, account. However this solution does not work for the version beacon data, which would also need to be moved. Moving the version beacon data to a different account is much much harder as it has a lot of dependencies outside of execution.
In this PR I changed the FVM to instead read the version beacon data from protocol snapshot. We already read the Entropy source from the protocol snapshot, so I bundled these two things into a subset of the protocol snapshot that the FVM consumes for execution. This also prepares us for the future, where the execution version is going to be inside the dynamic protocol state (on the protocol snapshot).